import { FormSchema } from '/@/components/Form';
import { getPeriodTreeByQuarter } from '/@/api/common/api';
import dayjs from 'dayjs';
import quarterOfYear from 'dayjs/plugin/quarterOfYear';
dayjs.extend(quarterOfYear);

export const basicFormSchema: FormSchema[] = [
  {
    field: 'periodCode',
    label: '考核周期',
    required: true,
    component: 'ApiTreeSelect',
    componentProps: {
      api: getPeriodTreeByQuarter,
      fieldNames: {
        children: 'child',
        label: 'periodName',
        value: 'periodCode',
      },
    },
    defaultValue: dayjs().startOf('year').format('YYYY') + 'Q' + dayjs().quarter(),
  },
  {
    label: '考核对象',
    field: 'assessPerson',
    required: true,
    component: 'ZSelectDept',
    componentProps: () => {
      return {
        sync: false,
        titleKey: 'orgName',
        rowKey: 'orgCode',
        multiple: true, //多选
        maxTagCount: 3,
        isSuper: true,
        params: {
          status: 0,
        },
      };
    },
  },
  {
    field: 'expirationTime',
    label: '截止时间',
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
    defaultValue: dayjs(),
    required: true,
  },
  {
    field: 'informMessage',
    label: '通知内容',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请输入通知内容',
    },
  },
];
